<!--
 * @Author: 段本显
 * @FilePath: \my-vue-app\src\views\Home.vue
 * @Date: 2021-12-29 20:03:43
 * @LastEditors: 段本显
 * @LastEditTime: 2022-01-04 14:01:56
 * @Email: duanbenxian@jianq.com
 * 如果有bug，那肯定不是我的锅，噜噜噜
-->
<template>
  <PullPage @pullUp="onLoad" @pullDown="onRefresh" :updateData="list">
    <van-button type="primary">主要按钮</van-button>
    <ul>
      <li v-for="(item, index) in list" :key="index">{{ item.text }}</li>
    </ul>
  </PullPage>
</template>
<script lang="ts" setup>
import { reactive, toRefs } from 'vue'
import useCurrentInstance from '@/hooks/useCurrentInstance'
const { globalProperties } = useCurrentInstance()
console.log(globalProperties)

const { list, count } = toRefs(
  reactive({
    count: 0,
    list: new Array(10).fill(1).map((el, index) => ({ text: index })),
  })
)
const onLoad = () => {
  console.log('onLoad')
  setTimeout(() => {
    count.value = 4
    list.value.push(
      ...new Array(10).fill(1).map((el, index) => ({ text: index }))
    )
  }, 2000)
}
const onRefresh = () => {
  onLoad()
}
// import HelloWorld from '@/components/HelloWorld.vue'
</script>
